<div class="page">
<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'inheritance'} %>

<div class="tabs-panel marginbottom10">

  <table width="100%">
    <tr>
      <td align="center"  valign="top">
        <div>
          <% @ancestors.reverse.each do |parent| %>
            <a href="<%= url_for :action => 'inheritance', :id => parent.id() -%>"><%= parent.name() -%></a>
            <span class="note">(<%= label_for_rules_count(parent, @all_profile_stats) -%>)</span><br/>
            <%= image_tag 'blue-up.png' -%><br/>
          <% end %>

          <b><%= @profile.name -%></b> <span class="note">(<%= label_for_rules_count(@profile, @all_profile_stats) -%>)</span><br/>

          <% if @children.size>0 %>
            <%= image_tag 'blue-up.png' -%><br/>
            <% @children.each_with_index do |child,index| %>
              <%= ', ' if index>0 -%>
              <a href="<%= url_for :action => 'inheritance', :id => child.id() -%>"><%= child.name() -%></a>
              <span class="note">(<%= label_for_rules_count(child, @all_profile_stats) -%>)</span>
            <% end %>
            <br/><%= image_tag 'blue-up.png' -%><br/>
            ...
          <% end %>
          </div>
      </td>
     <% if profiles_administrator? %>
       <td valign="top" width="300">
         <div class="admin">
           <h3><%= message('quality_profiles.set_parent') -%>:</h3>
           <p><%= message('quality_profiles.inherit_rules_from_profile') -%>:</p>
           <% form_tag({:action => 'change_parent'}, {:method => 'post'}) do %>
             <%= hidden_field_tag "id", @profile.id() %>
             <%= select_tag "parent_id", options_for_select(@select_parent, (@parent.id() if @parent)) %>
             <%= submit_tag message('change_verb'), :id => 'submit_parent'%>
           <% end %>
         </div>
       </td>
     <% end %>
    </tr>
  </table>

</div>
</div>
